package com.cys.dm.controller;

import com.cys.dm.entity.item.DmItemComment;
import com.cys.dm.entity.scheduler.DmScheduler;
import com.cys.dm.rest.service.DmItemDetailService;
import com.cys.dm.vo.CommonResponse;
import com.cys.dm.vo.VoUtil;
import com.cys.dm.vo.dmitem.DmItemDetailResponse;
import com.cys.dm.vo.scheduler.DmSchedulerPicResponse;
import com.cys.dm.vo.scheduler.DmSchedulerSeatResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class DmItemDetailController {
    @Autowired
    private DmItemDetailService dmItemDetailService;

    @PostMapping(path = "/getItems")
    public CommonResponse<DmItemDetailResponse> dmItemCommentCommonResponse(@RequestBody Map<String,Long> map){
        DmItemDetailResponse dmItemComment = dmItemDetailService.queryItemDetail(map.get("id"));
        return VoUtil.returnSuccess("演出详情",dmItemComment);
    }

    @PostMapping(path = "/getTimePlan")
    public CommonResponse<List<DmScheduler>> getTimePlan(@RequestBody Map<String,Long> map){
        return VoUtil.returnSuccess("排期查询",dmItemDetailService.findSchedulerById(map.get("itemId")));
    }

    @PostMapping(path = "/getPrice")
    public CommonResponse<List<DmSchedulerPicResponse>> getPrice(@RequestBody Map<String, Long> map){
        return VoUtil.returnSuccess("商品价格",
                dmItemDetailService.queryItemPrice(map.get("scheduleId")));
    }

    @PostMapping(path = "/getComments")
    public CommonResponse<List<DmItemComment>> getComments(@RequestBody Map<String, Long> map){
        return VoUtil.returnSuccess("查询评论",dmItemDetailService.findAllByItemIdComment(map.get("id")));
    }

}
